vBulletin fetches the templates from the database, where they are stored in plain html.
What's special is that there are template conditionals in them that allow things to be shown or hidden depending on certain conditions (for example if a variable is true or not).
There's more information on template conditionals in the Documentation.
The templates themselve are called with the function fetch_template(), used in an eval() so that the variables are passed. The information is stored in variables and is output at the end of the page with do_output() (or something similiar

)