The line that fills the @pwchars array contains ..., '$', ... which causes emacs to mess up the coloring. It look at that and thinks you are putting the value of $' into the string (it's not smart enough to know what '' string can't contain variables). This causes the coloring of in string/other text to be reversed for the next few lines (somehow it eventually corrects itself). The solution is to escape the $.
Comment on attachment 53306 [details] [diff] [review] escape the $ $ isn't interpretted between single quotes. So far so good. \ is not interpretted either. I just ran this code: my $var = '\$'; print "$var\n"; The output was: \$ Escaping the $ probably works, but try double-quotes around it instead.
Tempted to WONTFIX unless someone else is really bothered by this. Emacs version 21.1 seems to have fixed this coloring bug. Of course, if you can't/don't want to upgrade emacs, this will still be an issue.
We are currently trying to wrap up Bugzilla 2.16. We are now close enough to release time that anything that wasn't already ranked at P1 isn't going to make the cut. Thus this is being retargetted at 2.18. If you strongly disagree with this retargetting, please comment, however, be aware that we only have about 2 weeks left to review and test anything at this point, and we intend to devote this time to the remaining bugs that were designated as release blockers.
No complaints in two years, patch has rotted slightly, emacs 21.1+ handles coloring of the relevant lines just fine. Nearly everywhere has at least that version of emacs (hell, even debian unstable... :). Wontfix.