Lowercase when referring to the command, uppercase when referring to it as a project or a piece of software as a whole. "grep" is a command with certain behavior; Grep (or GREP) is a tool on Linux.
How does that sound?
There's some reasonable overlap where you might mean one or the other, but to maintain that there's no reason to make it uppercase?