I tried to find a solution in Blender to control only the shadow and highlight areas in the Compositor. This is possible in Photoshop with luminosity masks. I couldn't find any solution, so I tried to recreate a node that does that.
Luminosity masks are selections based on brightness. They allow us to select — and make changes to — bright, dark or mid-tones in our image. This opens up a whole new world of processing, not to mention an effective way to blend exposures.
Why are Luminosity Masks useful?
Maybe you want to add more contrast to an image, but you don’t want to affect the shadows because they’ll become clipped. You just want to add contrast to the highlights. You just choose the brightness mask and apply it as alpha to a node and after you add a curve. In the example file I tried to recreate an Orton Effect, a popular Photoshop effect, some kind of fantasy/dreamy colours. You can check what each node does. The monochrome images are luminosity masks in the examples. Whatever is white or grey in the mask is a ‘selected’ area, meaning any changes we make will only affect those areas. The lighter the grey the more affected that area will be. Dark areas will be unaffected by any changes.