attr() is a jquery method. .attr( attributeName, value ) it assigns or changes an attribute.
‘rel’ describes the relationship between the current document and the document or anchor specified in the href attribute. We see it in <link rel="stylesheet" type="text/css" href="something.css" />, but it is misused all over. This may be one of those cases.
The attr('rel', 'gallery') is used to unite a group of images with the rel being an attribute and every image to be linked has rel set to the same value.
Don't have to they are explained in the documents http://fancyapps.com/fancybox/#docsQuote:
can you give me a comment on each of these fields