Safari installs a Service which lets you use text selected in any application as a search query in Google. If you've enabled it in System Preferences » Keyboard » Services, normally the service appears in the contextual menu option when you Control-click on some text. However for some reason it doesn't show up in the contextual menu in Terminal.app. I found a way to enable it in Terminal as well.
Right click and select 'Show Package Contents' on Safari. Then edit Contents/Info.plist inside the Safari.app package. Find the section with the types of data accepted by the service:
<key>NSSendTypes</key> <array> <string>NSStringPboardType</string> </array>
<key>NSSendTypes</key> <array> <string>NSStringPboardType</string> <string>public.utf8-plain-text</string> </array>
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110219155334182