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>
/System/Library/CoreServices/pbs
The 'Search with Google' option should now appear in the context menu in Terminal.app.
[crarko adds: I haven't tested this one. Note that the Google Search Service does already show up in the Services menu in Terminal without performing this change. As always, when making these changes internal to a code-signed application package, make sure you have a clean backup. I often just make a zip archive of the application before making edits to the original. Time Machine backups work, as long as you have one that predates the changes.]

