A useful result when dealing with backward stochastic differential equations is the comparison theorem of Peng (1992). When the equations are not based on Brownian motion, the comparison theorem no longer holds in general. In this paper we present a condition for a comparison theorem to hold for backward stochastic differential equations based on arbitrary martingales. This theorem applies to both vector and scalar situations. Applications to the theory of nonlinear expectations are also explored.