Shaping is a body posture that is assumed in the course of dancing to assist in dance partnership and to provide emphasis to certain movements. When shaping, one is still balanced. For example, if I am shaping left, stepping on my right foot, as the man would do on the second step of the quickstep running finish, he could stop on that foot and still be balanced. That balanced is achieved by shifting the hips to the right over the leg, while the spine tilts left. The tilt of the spine is counterbalanced by the hips.
This same idea applies to the standard frame in closed position. The knees bend, and the hips come forward. The hips coming forward is counterbalanced by the spine tilting back, creating a bigger frame. The spine tilts left, and the hips move to the right over the legs, counterbalancing each other, and creating the shaping to the left, and the big topline.
What's sway, then, and how is it different from shape? Instead of counterbalancing body parts against each other, the tilt of the whole body is used to counterbalance against a change of momentum. If you are walking along, and something like a curb stops the motion of your feet, the rest of your body still has momentum, and keeps going. You fall down, a victim of gravity and Newton's first law of motion. If you see the curb is there, and you want to stop your motion before you trip, you lean in the direction opposite of your motion. If you are a pretty well balanced person (if you can walk unassisted you are pretty well balanced), you will lean back just enough that gravity and your momentum will balance each other out, and you will come to a stop.
The greater the change in momentum, the greater the lean you will need to change your momentum. That's why bicyclists, motorcyclists, runners, skaters, etc, lean so far into a turn, they are making big changes to the direction of their momentum.
Now, what's all that got to do with dance? If you are doing, for example, a natural turn in waltz, your first two steps are in a straight line. On the third step, you are bringing your feet together, and coming to a stop. You have also turned your body, so as you are bringing your feet together, you are moving to your side. If you have little momentum, you will lean away from the movement a little bit, to help you come to a stop. For example, in the natural turn, the man will be leaning a little to his right as he is bringing his feet together. If there is not much momentum, the lean may be unnoticeable to anyone watching, but it is still there, or the couple would start to fall over a bit to the man's left. If the couple has a lot of momentum coming into the third step, they will need to lean much more to the man's right to counter the couple's momentum. That's why competitve ballroom dancers have so much sway, because they are moving so fast across the floor, and need to make much bigger changes in their momentum.
In short, you don't need to try to sway. Sway is a natural consequence of staying in balance as you change your momentum.