The electrochemical oxygen reduction reaction (ORR) provides a green route for decentralized H2O2 synthesis, where a structure–selectivity relationship is pivotal for the control of a highly selective and active two‐electron pathway. Here, we report the fabrication of a boron and nitrogen co‐doped turbostratic carbon catalyst with tunable B−N−C configurations (CNB‐ZIL) by the assistance of a zwitterionic liquid (ZIL) for electrochemical hydrogen peroxide production. Combined spectroscopic analysis reveals a fine tailored B−N moiety in CNB‐ZIL, where interfacial B−N species in a homogeneous distribution tend to segregate into hexagonal boron nitride domains at higher pyrolysis temperatures. Based on the experimental observations, a correlation between the interfacial B−N moieties and HO2− selectivity is established. The CNB‐ZIL electrocatalysts with optimal interfacial B−N moieties exhibit a high HO2− selectivity with small overpotentials in alkaline media, giving a HO2− yield of ≈1787 mmol gcatalyst−1 h−1 at −1.4 V in a flow‐cell reactor.