I was reading A Quick Introduction To Basic Set Theory by Anush Tserunyan, and in definition 1.1, the author defined a notation of a formula in ZF with few criterias. One of them states:
If $\phi$ is a formula and $x$ is a variable, then $\forall x(\phi)$ and $\exists x(\phi)$ are formulas.
I remember in first-order logic, the formula is defined similarly, but it requires $\phi$ to contain the restricting variable, namely, x, in the above. Is it different in the case of ZF and can we write something like $\forall x(y=y)$?
Also, the author also said that $\phi(x)$ emphasized that this formula "says something about a set (variable) x". Should I assume this implies $\phi(x)$ must contains x? (for instance, in the case of axiom schema 5 of Comprehension.)
You're mistaken about first-order logic - there is no such requirement. $\forall x\,(y=y)$ is a perfectly good formula of first-order logic (and of ZF set theory).
When we write $\varphi(x_1,\dots,x_n)$, we mean that the only variables occurring free in $\varphi$ are among the $n$ variables $x_1,\dots,x_n$. There is no requirement that all $n$ of these variables actually appear free in $\varphi$. For example, $\varphi(x)$ might be $\exists y\,(y=y)$. We can interpret this formula as saying something about $x$, just not something interesing!