Not really sure anything can be done to help it if we want the current set of features, but is you type something like this in Ruby:
<<-HTML <style> HTML foo = 21
The 'foo = 21' part and the rest of the document is colored like a style-sheet. Normally this would be incorrect nesting of course, but for heredocs in languages, there can be good reasons for this (and it's in fact used in tmruby).
-- Sune.