An algebraic program of computation and characterization of higher-loop BRST anomalies is presented. We propose a procedure for disentangling a genuine local higher-loop anomaly from the quantum dressings of lower-loop anomalies. For such higher-loop anomalies we derive a local consistency condition, which is the generalisation of the Wess-Zumino condition for the one-loop anomaly. The development is presented in the framework of the field-antifield formalism, making use of a non-local regularization method. The theoretical construction is exemplified by explicitly computing the two-loop anomaly of chiral W3 gravity. We also give, for the first time, an explicit check of the local two-loop consistency condition that is associated with this anomaly.