Aha. The google term you're looking for is SYNTAX HIGHLIGHTER.


http://stackoverflow.com/questions/2556862/syntax-highlighting-in-ms-word-document

The general consensus out there seems to be:
- Paste your code into a code editor which already syntax-highlights your code the way you want,
- Then either copy/pastespecial that code from the editor into Word, where it will preserve the color formatting, or, use the code editor's "export as RTF/HTML" function, which will also preserve the color formatting.

The thing is, I don't know if there are any existing code editor tools out there which will bracket-match the way you want them to. You could experiment with some of them and find out.

If not, then, there are some after-the-fact syntax highlighters available such as:

http://www.planetb.ca/2008/11/syntax-highlight-code-in-word-documents/
http://alexgorbatchev.com/SyntaxHighlighter/
http://www.gnu.org/software/src-highlite/
etc...

And some of those are open source. If you really wanted to dig in, you could take an existing syntax highlighter and modify it to include the bracket-matching that you want.
_________________________
Tony Fabris