did you look at the man page?
so for example if i wanna use grep to search through my rpm database to see if i have xine installed i can use:
rpm -qa |grep xine
and this will only output from my whole rpm database any words that contain xine.
so my results are:
if i would just type a simple rpm -qa i would get a huge list of everything and instead of searching through that list manually, i let grep do the work