Here are two explanations given by Jewish tradition: a) King David writes (Psalms 35:10), "All of my limbs shall proclaim: Who is like You..." When we praise God, we do so with all of our being: the mind, heart, and mouth express the prayer through speech, and the rest of the body does so by moving. Every fiber of our self is involved in connecting to our Creator. b) "The soul of man is a candle of God" (Proverbs 20:27). The candle's flame constantly sways and flickers as it attempts to tear free of its wick and ascend on high. Our soul is also engaged in a constant effort to escape the corporeality of this mundane world and cleave to its Godly source. This is especially true in the course of prayer, those islands in time when we concentrate and focus on our relationship with God. Our body mirrors this effort as it sways back and forth like a flame.