XML is a markup language that structures documents by using tags to describe content. It is derived from SGML and allows users to define their own tags for exchanging data across different systems. XML documents use tags to describe data rather than display it like HTML. Documents must follow specific rules to be considered well-formed, including proper nesting of tags. XML is commonly used to transfer data between systems and has advantages like being human-readable and requiring less storage space than other formats.