Cosmological Perturbations in Brane-World Theories: Formalism