Why is pasted text highlighted in macOS Catalina's Terminal?

As of macOS Catalina, the default shell for new accounts is now zsh instead of bash.

zsh has a feature called "bracketed paste" that allows the shell, specifically the zsh's line-editing mode known as "zle", to handle pasted text differently than if the same text had been typed in one character at a time, assuming your terminal emulator supports it, which macOS's built-in Terminal.app does. It's this "zsh line editing bracketed paste" that's highlighting your text.

To disable this feature, unset the "zle_bracketed_paste" environment variable:

% unset zle_bracketed_paste

You should be able to add that command to an appropriate shell startup script so that it's invoked every time (putting it in ~/.zlogin worked for me).

Or you could switch your shell to bash if that's what you'd prefer:

% chsh -s /bin/bash

If you'd like to learn more about zsh's line editing mode's support for bracketed paste, see the zshzle and zshparam man pages.

Catalina's built-in version of bash is pretty old and doesn't support bracketed-paste, but the latest versions of bash do, so if you've installed, and are running, a version of bash recent enough to support bracketed-paste, you can disable it with the command bind "set enable-bracketed-paste off". You can add that bind command to the appropriate bash shell startup file for your situation, or you can add just the set enable-bracketed-paste off part of it to your ~/.inputrc.