phranque - 11:23 am on Mar 8, 2013 (gmt 0)
technically the url of the document stops before the #.
this is the url google indexes.
the part after the hash mark/pound sign is a "fragment identifier" and the legacy term "anchor" is based on now-deprecated markup.
google will sometimes use the url-with-fragment-identifier for a "Jump to" link in the SERP snippet.
for example, a search for many of the apache directives will show the url of the relevant document and an additional link within the snippet the specific document fragment that applies to your search.
apache rewriterule - Google Search:
if i had to guess they include the "Jump to" link based on a preponderance of usage in inbound links.
discussion here - Seeing more Google jump-to options now:
google will also sometimes show a row of "sitelinks" that are referring to fragment identifiers in the indexed document.
RewriteCond - Google Search:
from my observations this is typically occurs in conjunction with a well-constructed navigation menu for on-page content.
they first started doing this type of sitelinks for wikipedia and it was discussed here several years ago.
Page Fragment Navigation in Mini Sitelinks - and snippet!: