A smart grid (SG) is a modernized electric grid that enhances the reliability, efficiency, sustainability, and economics of electricity services. Moreover, it plays a vital role in modern energy infrastructure. The core challenge faced by SGs is how to efficiently utilize different kinds of front-end smart devices, such as smart meters and power assets, and in what manner to process the enormous volume of data received from these devices. Furthermore, cloud and fog computing provide on-demand resources for computation, which is a good solution to overcome SG hurdles. Fog-based cloud computing has numerous good characteristics, such as cost-saving, energy-saving, scalability, flexibility, and agility. Resource management is one of the big issues in SGs. In this paper, we propose a cloud-fog-based model for resource management in SGs. The key idea of the proposed work is to determine a hierarchical structure of cloud-fog computing to provide different types of computing services for SG resource management. Regarding the performance enhancement of cloud computing, different load balancing techniques are used. For load balancing between an SG user's requests and service providers, five algorithms are implemented: round robin, throttled, artificial bee colony (ABC), ant colony optimization (ACO), and particle swarm optimization. Moreover, we propose a hybrid approach of ACO and ABC known as hybrid artificial bee ant colony optimization (HABACO). Simulation results show that our proposed technique HABACO outperformed the other techniques.