What are the 3 gray level regions? 0 to 100, 101 to 254, and 255? Then what do you want to do? Do you want to change the histogram so that it's totally flat in each of those regions? I think that would give a strange looking image as most histogram equalized images are. But if you want, I have code that lets you map your image to any histogram shape that you want. It's here in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/28972-custom-shaped-histogram
Or maybe you just want imquantize():
posterizedImage = imquantize(grayImage, numberOfLevels);
If neither of these is what you want, then explain better.