TERM variable is used by programs running in a terminal. It is supposed to allow programs to determine the capabilities of the terminal (or emulator) which is handling their output. It is documented in the
The terminal itself, including emulators such as
xterm, doesn’t care about the value of
TERM, beyond setting it (in the case of emulators — physical terminals can’t). It knows how to handle certain output sequences, and it handles them, without caring about
TERM or anything else apart from its internal state. You can set
TERM to anything you like in your shell, or even unset it, without changing the terminal’s behaviour; for a start, the terminal doesn’t know what
TERM is set to!
Programs which care about
TERM are typically those which use an output library which cares, such as ncurses, or in a more basic form Termcap or Terminfo. This includes shells such as Bash and Zsh, which use terminfo, for example for line editing features (being able to erase the line when you move up and down the history). These map the value of
TERM to a database of capabilities, which tell the program or library whether the terminal can perform certain tasks (such as moving the cursor, clearing the screen, changing colours) and how to go about it. Some programs, such as GNU
grep, assume capabilities without even checking.
xterm won’t change much, in particular it won’t disable colour support in programs which refer to
xterm supports colour output too. The difference is in the number of colours which are supported.
See How do keyboard input and text output work?, Colors in Man Pages, Which terminal type am I using?, What protocol/standard is used by terminals? for more detail.