The gray model results from starting with the assumption that we have a plane-parallel slab:
The light ray from the source (i.e., the star's atmosphere) travels at some angle, $\theta$, from normal, $z=0$. Since the light is coming from an angle, we need to account for that by modifying the radiative transfer equation to have a vertical optical depth, defined by
$$
\tau_{\lambda,v}(z)=\int_z^0\kappa_\lambda\rho\,dz
$$
which gives us
$$
\omega\frac{dI_\lambda}{d\tau_{\lambda,v}}=I_\lambda-B_\lambda
$$
with $\omega=\cos\theta$. Since the path length of the ray does not offer a unique geometric depth of the atmosphere, we cannot use $\nabla I$ and must use the above form for the radiative transfer equation.
In most stellar atmospheres, the primary source of opacity is the photoionization of H$^-$ ions. Fortunately, the opacity from photoionzation of hydrogen ions does not vary rapidly with wavelength, so we can approximate the opacity as
$$
\kappa_\lambda\approx \bar\kappa
$$
where $\bar\kappa$ is some average opacity, usually the Rosseland mean opacity.