The "first form" is a... feature of
groff. If your "nroff" is not a wrapper for
groff, you will see only the second form.
The feature is referred to in the manual page for
grotty (groff driver for typewriter-like devices):
By default, grotty emits SGR escape sequences (from ISO 6429, also called ANSI color escapes) to
change text attributes (bold, italic, colors). This makes it possible to have eight different back-ground background
ground and foreground colors; additionally, bold and italic attributes can be used at the same time
(by using the BI font).
In practice, it does not work well, e.g., see how the same comment (post-processing those sequences) is misrendered here:
By default, grotty emits SGR escape sequences (from ISO 6429, also called ANSI color escapes) to change text attributes (bold, italic, colors). This makes it possible to have eight different M[green]backgroundM and m[red]foregroundm colors; additionally, bold and italic attributes can be used BI]at the same time] (by using the BI font).
and for that reason, some developers choose not to use it (e.g., this discussion from Emacs mailing list).
However, as the manual page says "By default". So, if you have groff, then it should be producing those escape sequences.
Packagers may apply patches to modify programs. A comment by @muru mentions the version in Debian (see bug reports and package page). The package changelog says this:
-- Colin Watson <firstname.lastname@example.org> Sat, 27 Jul 2002 18:41:46 +0100
groff (1.18-1) unstable; urgency=low
* Disable the new ANSI colour/bold/underline escapes in nroff mode,
because most pagers either fail to cope with it or need special options
to do so. It can be re-enabled by editing /etc/groff/man.local and
/etc/groff/mdoc.local, or by setting the environment variable GROFF_SGR
to something non-empty.
However, the groff source does not mention
GROFF_SGR; it has only references to
./NEWS:1108: for the GROFF_NO_SGR environment variable also.
./NEWS:1450:o If the environment variable GROFF_NO_SGR is set, SGR output is disa...
./PROBLEMS:33: 1. Set the GROFF_NO_SGR environment variable.
./doc/webpage.ms:1920:. URL #GROFF_NO_SGR GROFF_NO_SGR
./doc/webpagewebpage.ms:1922:. nop GROFF_NO_SGR
./doc/webpagewebpage.ms:2439:If the environment variable GROFF_NO_SGR is set, SGR output is
./src/devices/grotty/tty.cpp:864: if (getenv("GROFF_NO_SGR"))
and the changelog (ChangeLog.118) gives no clue:
2002-02-12 Werner LEMBERG <email@example.com>
* src/libs/libgroff/Makefile.sub (snprintf.o): Don't use
$(COMPILE.c) to not include groff's assert.h.
* src/drivers/grotty/tty.cc (main): Add GROFF_NO_SGR environment
* NEWS, src/drivers/grotty/grotty.man: Document it.
GROFF_NO_SGR will not give SGR sequences (the manpage is correct). The Debian changelog comment refers to this chunk from
/etc/groff/man.local, where Debian added a check for the
. \" Debian: Disable the use of SGR (ANSI colour) escape sequences by
. \" grotty.
. if '\V[GROFF_SGR]'' \
. output x X tty: sgr 0
and setting the environment variable does make it generate SGR sequences for bold, etc.