DTD and XML Schema are often used to define tags and attributes the should be used to properly write an XML files. Using them, it is thus possible to validate the content of XML files not just against the strict XML language syntax, but also looking at the content of each tag.
Is there an equivalent to this for other languages like JSON and YAML?
JSON has a schema language, as already stated in the comment (http://json-schema.org). JSON schema does allow validation of values as well as tags. It's not as mature as XML Schema, and in my own (subjective) opinion it is not as rigorously specified.
Apparently, JSON schema can also be used to describe YAML documents. See YAML Schema Validation?.