They are documented in the manual, but it doesn't use the word “fence”. The characters
| are listed as “generic comment delimiters” and “generic string delimiters” in the syntax class reference.
These characters were introduced in Emacs 20.1. Quoting the NEWS file:
There are two new syntax-codes,
| (numeric values 14
and 15). A character with a code
! starts a comment which is ended
only by another character with the same code (unless quoted). A
character with a code
| starts a string which is ended only by
another character with the same code (unless quoted).
These codes are mainly meant for use as values of the `syntax-table'
I can't find any use of
! in the standard Emacs modes. There are several uses of
|. The intended use case is languages which have literals that use delimiters other than the usual string delimiters, usually set via overlays added by font locking based on the context. For example, in perl, a regular expression match can be written
m[REGEXP] or any number of variations. A literal string can be written
'STRING' but also
q[STRING], etc. When font lock recognizes such constructs, it sets the quote characters (
] in the examples I gave) to generic string delimiter syntax. Even if a habitual string delimiter is present (e.g.
q[foo"bar]), that delimiter will be considered an ordinary part of the string, it won't terminate the string.
I admit that I don't see a definitive benefit — for example CPerl mode does some very fancy things and doesn't use this facility.