Using the tight-binding approach, we study the band gaps of boron nitride (BN)/ graphene nanoribbon (GNR) planar heterostructures, with GNRs embedded in a BN sheet. The width of BN has little effect on the band gap of a heterostructure. The band gap oscillates and decreases from 2.44 eV to 0.26 eV, as the width of armchair GNRs, , increases from 1 to 20, while the band gap gradually decreases from 3.13 eV to 0.09 eV, as the width of zigzag GNRs, , increases from 1 to 80. For the planar heterojunctions with either armchair-shaped or zigzag-shaped edges, the band gaps can be manipulated by local potentials, leading to a phase transition from semiconductor to metal. In addition, the influence of lattice mismatch on the band gap is also investigated.