The most well-known tools for structuring text databases are:
SGML - a language in which one designs application-specific markup languages.
HTML - Hyper Text Markup Language
This is the common language used for creating documents on the web.
Note that HTML is properly defined in terms of an SGML markup language. And that it is not a typesetting language.
Unfortunately, HTML isn't a terribly expressive markup language, and since people want to express more than it allows for, it has proven necessary to create a variety of extension schemes that tend to stretch it well past the point at which it breaks.
XML is a markup language that falls in between SGML and HTML in terms both of power and of complexity of implementation.
On the one hand, HTML is not featureful enough and provides no capabilities for extensions. On the other hand, SGML is very complex to implement, and is thus "too big" to embed in applications.
XML seeks to fall in between the two, and be useful as a portable document format.