|You'll probably hate me for answering to your post without giving you the answer you want.
But it doesn't exist.
When your application sends out some text on a serial line, going to a teletype or CRT or whatever, it sends that text away. The text on your screen is not the string in your application. It is a copy of a string in your application - a copy that has been sent away.
Imagine yourself sending a letter (in the paper sense) to a friend. This friend picks up his yellow marker to highlight a couple words that you wrote; he might refer to those words when replying to you. You are asking for a way to change the letter you sent him a day or two ago, in the words that your friend highlighted. You can't. The words are no longer under your control.
The xterm highlighting you see is completely independent of your application. xterm is like a remote friend of the application: The text(copy) belongs to xterm, and it is xterm doing the highlighting, completely out of the control of the application. Whatever your xterm wants to do with the highlighted word(s), it can do. Essentially, it can copy the word(s) into a copy/paste buffer and paste it in as part of the input so that you don't have to type it on the keyboard. The application knows nothing about this copy/paste business and sees the paste as if it was typed.
If you want your application to be aware of highlighting done by the user, xterm is not the right tool You will have to write your own X11 client. It may look quite similar to that xterm client at the UI, but it will have a very different interface to your application, not trying to emulate an RS232 connected dumb terminal, the way xterm does.