theme is an interchangeable set of templates and front-end code. Themes makes it easy to switch between different front-end code for the same back-end code.
Themes may sometimes be able to extend and configure the system in which are used and define certain capabilities of it self. Themes may also have ways to split up big templates into more focused parts. Themes can also sometimes inherit templates etc from a defined parent theme.
Open Source Examples
Drupal supports themes. They can inherit from each other, provide a bit of additional capabilities and also rewrite render requests to render something else than initially requested to that way either consolidate many templates into a single one or to split a big one up into smaller more focused parts and Drupal in itself also provides mechanisms for splitting up templates into more focused parts out of the box.
Standalone Theme Engines
Pelle Wessman has built and is using a standalone Node.js theme engine, Tema, for some of this projects, such as A WebMention Endpoint. It's inspired by how eg. Drupal's themes works and supports child themes, rewriting render requests, using multiple template engines in the same theme etc.