In this paper, the electronic structure in armchair graphene nanoribbons (AGNRs) and graphene nanoribbons doped B at the edge (B-AGNRs) are obtained based on the first principle theory. It shows that the band gap has the oscillation characteristic whose period is 3. The band gap oscillating characteristic gradually vanishes and tends to be stable after doping B at graphene nanoribbons edge. This provides a theoretical guidance for developing the stable graphene nanodevices.