Effect of inhomogeneous intergranular phases on magnetic properties of nanocomposite magnets