Covalent organic frameworks (COFs) with hollow structures hold great promise for developing new types of functional materials. Herein, we report a hollow spherical COF with a hierarchical shell, which serves as an effective precursor of B,N-codoped hierarchical hollow carbon spheres. Benefiting from the synergistic effects of hierarchical porosity, high surface area, and B,N-codoping, the as-synthesized carbon spheres show prospective utility as metal-free catalysts in nitroarene reduction. A mechanistic hypothesis is proposed based on theoretical and experimental studies. Boron atoms situated meta to pyridinic N atoms are identified to be the main catalytic active sites. The anti-aromaticity originating from the codoping of B and pyridinic N atoms, not charge distribution and deformation energy, is confirmed to play a pivotal role in the catalytic reaction.