Segregation occurs in many geophysical flows with plastic behaviour including avalanches and rock-slides, but there is no generally accepted theory and almost no quantitative comparisons. We develop a general theory of segregation based on multi-component diffusion, analyse its consequences and compare the predictions with discrete element method simulations. The effects of the segregation on the frictional rheology are analysed.