Unless text selection is sufficient, you can't do it directly with a textbox.
I recommend you think carefully about whether selecting a text range is sufficient.
You can do that based on character from and to and you could override the system brush making it whatever colour you like.
If that isn't sufficient then.
You'd need some other control under the textbox which made it look like it's the background of the textbox changing.
One way to do this would be to use an itemscontrol you template into textblocks and colour their backgrounds.
You put that under your textbox so it's background shows through. Probably best to set the text the same colour as your background as well so no small offsets cause problems.
Alternatively, you could use a lineargradientbrush and calculate where the characters are. This would be quite tricky though.