The grep utility searches text files for patterns and prints matching lines. It has two versions: /usr/bin/grep which uses basic regular expressions to match patterns, and /usr/xpg4/bin/grep which allows full regular expressions with options like -E. Both versions accept options like -c to count matches or -i for case-insensitive searching and print file names or line numbers for context.