The encoded MDCT coefficients are grouped into scalefactor bands, allowing an efficient coding. Noise shaping introduces as much quantization noise as the masking for a particular band allows.
It does this by adjusting the quantization stepsize. The larger the stepsize, the more quantization noise you'll get. In Mpeg layer3 the global gain defines the largest stepsize to use. The scalefactors are used to reduce the stepsizes for the special needs of the scalefactor bands.
While there already is an inherent noise shaping in the non-linear quantizer it is usually not sufficient to achieve acceptable audio quality. To improve the subjective quality of the coded signal the noise is further shaped via scalefactors. The way the scalefactors are working is the following:
Scalefactors are used to amplify the signal in certain spectral regions (the scalefactor bands) to increase the signal-to-noise ratio in these bands. Thus they implicitly modify the bit-allocation over frequency since higher spectral values usually need more bits to be coded afterwards. Like the global quantizer the stepsize of the scalefactors is 1.5db.
To properly reconstruct the original spectral values in the decoder the scalefactors have to be transmitted within the bitstream.
Whenever a scalefactor band is amplified, it will force the next quantization to use more bits for that band. This will result in more bits used to encode the MDCT coefficients in that band, and thus less quantization error. That is why bands with audible distortion are amplified. However, it will also result in less bits for the unamplified bands. But these bands had a quantization error less than the allowed masking, so hopefully they can tolerate a little more noise. The whole procedure is designed to allocate the bits to the bands which need them the most.