You mentioned you're pasting to terminal. Abandon here-doc altogether, and use a proper clipboard utility, such as xclip
(or pbpaste
on Mac OS X). With xclip
that'd be done as
xclip -o -sel clip | grep --color 'sometext'
See also 'xclip' vs. 'xsel' on the difference between the two utilities.