In TeX, the same characters (namely, { and }) are used for grouping and to define macros (\def{...}). I think that this is because it can be distinguished from context which one is which.
So, sometimes { and } are equivalent to \begingroup and \endgroup, and sometimes not. But it turns out that there is one more way how curly braces are used.
Consider answer to exercise 17.16 in TeXbook:
\def\sqr#1#2{{\vcenter{\vbox{\hrule height.#2pt
\hbox{\vrule width.#2pt height#1pt \kern#1pt
\vrule width.#2pt}
\hrule height.#2pt}}}}
\def\square{\mathchoice\sqr34\sqr34\sqr{2.1}3\sqr{1.5}3}
We can remove one level of outer braces from \def\sqr and use them directly in \def\square like this:
\def\square{\mathchoice{\sqr34}{\sqr34}{\sqr{2.1}3}{\sqr{1.5}3}}
So, in what sense are braces used in \mathcoice? They are not here to create block structure (because here we cannot replace { and } to \begingroup and \endgroup), and these braces do not define a macro here. BTW, why those braces are necessary for \mathchoice (isn't \vbox returned by \sqrXY a single token)?
Also, in what sense is { used in \uppercase\expandafter{\romannumeral\year}: why cannot { and } here be replaced by \begingroup and \endgroup?
How to distinguish in each occurence of { or } in what sense it is used? For example, if we type {12} it means that TeX sees token 12, or that TeX executes \begingroup 12 \endgroup? If the latter is true, how does the outer function, to which {12} is passed as an argument, gets 12? Is it that last token between \begingroup ... \endgroup is returned by \endgroup or some other mechanism is used?
EDIT: In this connection, why do we need curly braces around \mathchoice... in the following code from exercise 17.15? (i.e., why it does not work without them?)
\def\puzzle{{\mathchoice{D}{T}{S}{SS}}}
$$\puzzle{\puzzle\over\puzzle^{\puzzle^\puzzle}}$$
Compare with the following, where \alpha is used without extra braces:
$$\alpha{\alpha\over\alpha^{\alpha^\alpha}}$$
Also notice that in the answer to exercise 17.16 Knuth does not put braces around \mathchoice.... Why?
\def\sqr#1#2{{\vcenter{\vbox{\hrule height.#2pt
\hbox{\vrule width.#2pt height#1pt \kern#1pt
\vrule width.#2pt}
\hrule height.#2pt}}}}
\def\square{\mathchoice\sqr34\sqr34\sqr{2.1}3\sqr{1.5}3}
{and}are never equivalent to\begingroupand\endgroup. – egreg Sep 13 '15 at 22:34{\endgroupis an error (unlike{\egroupwhich is not always an error. the log file distinguishes these assemi simple group(which is probably a joke name:-) – David Carlisle Sep 13 '15 at 22:39