If you use SVN for version control, you've probably run into situations where there are undesirable matches to your egrep command from resources within .svn directories. It's easy enough to avoid that by piping the output of your first egrep into a second that does an inverted search (ie. returns anything that does not match the expression):
egrep -rn 'hook_form_alter' . | egrep -v '\.svn'
It's the -v option that does the inverting.