This snippet is actually a set of advanced macros that provide some useful predefined commands. You can just copy the whole code, paste it in a separate file, named, for instance, 'book-titling.ily'; then just include it in your score and use the provided macros (see the end of the snippet description if you want an example of an actual score source file).
This snippet allows you to create:
string
defines the book title, as it should appear in even page header
string
adds a page break and a big title, and a title in the TOC set the odd page header
string
adds a section title, and a title in the TOC
markup
adds a piece title in the TOC
markup
adds a piece title in book body and in the TOC
boolean
if set to 'true', adds rehearsal number before pieces
stylesheet(you may save it as a separate file named "book-titling.ily", and then include it in your scores), and at the bottom of the source code, a short example demonstrating some of these abilities.