First, note the that single slash matches too much:
$ echo $'eegg \n e.g.' | grep e\.g\.
eegg
e.g.
As far as bash is concerned, an escaped period is the same as a period. bash passes on the period to grep. For grep, a period matches anything.
Now, consider:
$ echo $'eegg \n e.g.' | grep e\\.g\\.
e.g.
$ echo $'eegg \n e.g.' | grep e\\\.g\\\.
e.g.
$ echo $'eegg \n e.g.' | grep e\\\\.g\\\\.
$
When bash sees a double-slash, is reduces it to a single slash and passes that onto grep which, in the first of the three tests above, sees, as we want, a single slash before a period. Thus, this does the right thing.
With a triple slash, bash reduces the first two to a single slash. It then sees \.
. Since an escaped period has no special meaning to bash, this is reduced to a plain period. The result is that grep sees, as we want, a slash before a period.
With four slashes, bash reduces each pair to a single slash. bash passes on to grep two slashes and a period. grep sees the two slashes and a period and reduces the two slashes to a single literal slash. Unless the input has a literal slash followed by any character, there are no matches.
To illustrate that last, remember that inside single-quotes, all characters are literal. Thus, given the following three input lines, the grep command matches only on the line with the literal slash in the input:
$ echo 'eegg
e.g.
e\.g\.' | grep e\\\\.g\\\\.
e\.g\.
Summary of bash behavior
For bash, the rules are
Two slashes are reduced to a single slash.
A slash in front of a normal character, like a period, is just the normal character (period).
Thus:
$ echo \. \\. \\\. \\\\.
. \. \. \\.
There is a simple way to avoid all this confusion: on the bash command line, regular expressions should be placed in single-quotes. Inside single quotes, bash leaves everything alone.
$ echo '\. \\. \\\. \\\\.' # Note single-quotes
\. \\. \\\. \\\\.
\\\.
and give grep\.
but it doesn't. good question – acidzombie24 7 hours ago