I was wondering if it was possible to have a richtextbox be used as a program that highlights syntaxs.

For example:

Completed Syntaxs:
<b>Hello!</b>
<i>Hello!</i>
<u><b>Hello!</b></u>

^^^
If it's completed then it does this color

<b>Hello!
<u>Hello!

^^^
If not then it does another color

<br>
<hr>

^^^
And finally tags that don't require a closing tag are set to another color.
Could somebody please give me some ideas on how to get started with this... or a commented working example?

I'm making a program for some friends who want to start to learn HTML (Myspace is their motivation, lol).