Add support for complex file extensions like ".coffee.md" or ".html.erb"

The entries in the fileNames field of a language definition can now also contain extensions since file names are checked before extensions are checked.

Supersedes #3122, #3172 and #3169 to reduce the chance for more merge conflicts.