My (somewhat limited) understanding is it's not necessarily the shape, but attempting to maintain the same cross sectional area along the length of the runners. Gas flowing is when a flow bench is used during different stages of porting to help determine where to remove material and how much, and also to match them as closely as possible (although I'm not entirely sure how this is done). The aim is not to open them up as much as possible wherever possible, but to keep it uniform. I believe the usual areas that get attention are around the valve guides, the inner radii of the port runners (usually tighter than the outside wall), behind the valves and around the spark plug holes. I think that knowing how much material can be removed from a particular head mostly comes from experience, after grinding through into a water or oil passage once you'll know not to go so far next time! It's a very skillfull and tricky job, as in most places the material thickness can't be measured.