The fiber gratings fabrication technology with the heating method in a photonic crystal fiber (PCF) based on structural change is examined. The principle of photonic crystal fiber gratings (PCFGs) is analyzed in theory. The heat transfer theory and finite element method are used to examine the thermal field distribution in the fiber and the influence of the air hole structure in the cladding, and the parameters of the laser beam in the process of grating fabrication are discussed. The results show that gratings can be formed by the periodic collapse of air holes in the cladding of PCFs. Under double-point heating condition, the energy is uniformly distributed in the radial direction and is approximate to Gaussian distribution in the axial direction. With the same size of the luminous spot, as the layers and radius of the air holes increase, the laser power needed to make the air holes collapse decreases. With the same laser power, as the luminous spot radius increases, the needed heating time increases. Moreover, the relationship between the laser power needed and the air filling rate is obtained as the number of layers of the air holes changes from 1 to 7. This kind of PCFG can overcome the long-term thermal instability of conventional gratings in substance and thus has great potential applications in the related field of optical fiber sensors.