This paper proposes a novel framework suitable for bilevel optimization in a system of commercial buildings integrated to smart distribution grid. The proposed optimization framework consists of comprehensive mathematical models of commercial buildings and underlying distribution grid, their operational constraints, and a bilevel solution approach which is based on the information exchange between the two levels. The proposed framework benefits both entities involved in the building-to-grid (B2G) system, i.e., the operations of the buildings and the distribution grid. The framework achieves two distinct objectives: increased load penetration by maximizing the distribution system load factor and reduced energy cost for the buildings. This study also proposes a novel B2G index, which is based on building's energy cost and nodal load factor, and represents a metric of combined optimal operations of the commercial buildings and distribution grid. The usefulness of the proposed framework is demonstrated in a B2G system that consists of several commercial buildings connected to a 33-node distribution test feeder, where the building parameters are obtained from actual measurements at an office building at Michigan Technological University.