An approach is proposed for calculating effective physical characteristics of a inhomogeneous medium with several levels of nesting of its microstructure --- the generalized effective-field approximation. With the help of this approach, an expression is obtained for an effective permittivity tensor of an inhomogeneous medium with ellipsoidal inclusions in a multilayered shell, the boundaries of all layers of which are ellipsoids. The proposed approach allows to take into account probabilistic distributions of orientations and forms of inclusions, as well as the presence of several types of inclusions. Two cases of matrix composites are considered: 1) with spherical isotropic inclusions with a multilayered shell; 2) with ellipsoidal anisotropic inclusions with a multilayered shell. For an inhomogeneous medium with homogeneous inclusions, this approximation is shown to produce the same result as the generalized singular approximation. Keywords: inhomogeneous medium, composite, matrix, inclusion, multilayered shell, generalized effective-field approximation, generalized singular approximation, effective permittivity.