The precise term here would be "torque". Indeed, the force applied at the gun itself is horizontal (or at least parallel to the axis of the barrel), But the shooter holds the gun at the grip, which is below the barrel. And this causes rotation of the barrel about the grip, meaning "up".
Imagine what would happen if instead we took a nail and placed it slightly below the barrel, and then hammered the gun to a table. At this position when the gun fires, force is applied on the barrel (due to Newton's third law as you mentioned), pushing it back. But the nail keeps the gun in place, so instead the gun would rotate about the nail.
So basically your hands define an axis of rotation, because they essentialy don't move when the gun is fired.
If you were to install a grip on both sides of the barrel and hold it firmly when firing, the gun would not rotate. But this would mean that all the energy of the recoil will be absorbed much more aggressively in your hands, so I wouldn't recommend it...