history will list the commands recently typed into the terminal.
grep will search the data you give it for a particular character or string of characters.
The pipe tells the system that you want to pass (pipe) the output from history to grep.
In this case grep is searching for anything that used h. Which in my case was everything in history.
Try some other letters or strings and you can see grep just gives you the matches:
history | grep his
history | grep z
history | grep py