Here are the basics. One person uses the yellow cue ball as their cue ball, and the other person the white one. On your turn, you must do two things:
1 Hit both of the other balls in either order.
2 Hit 3 or more rails with your cueball before contact is made with the second ball.
When you do this successfully you score a point and shoot again. When you miss it's your opponents turn. You play to a number of points agreed to before the game begins.
The most common 3 cushion shot is to hit the first ball and then 3 rails and then the second ball, but you could hit 4, 5, 6 etc rails in between and it's still good. You can also hit 3 or more rails before making contact with either ball and it's still good (very common when the two object balls are very close together). You can also hit some of your required rails before contact with each ball, as in rail first into the back of the first ball and then around several more rails until contact with the second ball. As long as 3 or more rails are hit before contact with the second ball it's a legal shot, no matter what order the ball contacts and cushions are done in.