Templates have been used for decades. Some early templates were used in the '80s to create mass-mailed form letters. These document templates continue to be used to this day. The concept has been expanded to HTML. Twig, moustache, and even PHP itself are all examples of HTML templating systems.
The idea is that you take your standard formatting principles (like HTML tags), and then create a system for embedding some extraneous logic in it so that an interpreter can format or otherwise output a dynamic result. Twig, moustache, and PHP are all different syntaxes for embedding sets of logic in HTML.
Y implements a new templating concept called "data templating" which works within the framework of key-value pairs. In data templating, you don't use any particular format (though YAML and JSON are both excellent methods for expressing key:value pairs).
The logic is expressed as particularly formatted strings and embedded text sequences. The format of these strings and text sequences is dependent on your data-templating implementation.
The Y system uses a syntax called Voom.