It's a bit tricky to figure out based just on the screenshot, but have you considered doing that in a pre-commit hook? I.e. before committing the comment, you look for @-mentions, and add the highlights there?
The way this looks, you will run into problems anyway because your current method doesn't seem to work in case 2 or more people are being @-mentioned.