For two variables, see W. Feit,
Some consequences of the classification of finite simple groups, in
*The Santa Cruz Conference on Finite Groups*, Proc. Sympos.
Pure Math. **37**, American Mathematical Society, Providence,
RI, 1980, pp. 175-181. The result is the following. A polynomial $f(x)\in\mathbb{C}[x]$ is *indecomposable* if
whenever $f(x)=r(s(x))$ for polynomials $r(x),s(x)$, then either
$\deg r(x)=1$ or $\deg s(x)=1$. Suppose that $f(x)$ and $g(x)$ are
nonconstant indecomposable polynomials in $\mathbb{C}[x]$ such that
$f(x)-g(y)$ factors in $\mathbb{C}[x,y]$. Then either $g(x)=f(ax+b)$ for some
$a,b\in \mathbb{C}$, or else
$$ \deg f(x) = \deg g(x) = 7,\ 11,\ 13,\ 15,\ 21,\ \mathrm{or}\
31. $$
Moreover, this result is best possible in the sense that for
$n= 7,11,13, 15, 21$, or $31$, there exist indecomposable polynomials
$f(x)$, $g(x)$ of degree $n$ such that $f(x)\neq g(ax+b)$ and
$f(x)-g(y)$ factors. The proof uses the classification of finite simple groups!