We consider the formation of photon spectrum at the photosphere of ultrarelativistically expanding outflow . We use the Fokker-Planck approximation to the Boltzmann equation , and obtain the generalized Kompaneets equation which takes into account anisotropic distribution of photons developed near the photosphere . This equation is solved numerically for relativistic steady wind and the observed spectrum is found in agreement with previous studies . We also study the photospheric emission for different temperature dependences on radius in such outflows . In particular , we found that for T \propto r ^ { -2 } the Band low energy photon index of the observed spectrum is \alpha \simeq - 1 , as typically observed in Gamma Ray Bursts .