A Smart Grid system involves many applications, such as power grid state monitoring and control, demand response, distribution automation, distributed generation and microgrids. They will generate a large volume of data traffic over the grid with different quality of service (QoS) requirements, which present challenges to the existing network architecture and protocols. In this paper, we propose to develop a framework based on software-defined networking to address the QoS issue in Smart Grid systems. We focus on providing better service for critical flows by dynamically setting up forwarding paths in the data plane. To that end, the control program will monitor the status of the network and direct critical flows over a better path by installing OpenFlow rules on the switches. We develop a path searching algorithm and implement it as a module for the Floodlight controller. The performance evaluations show that our approach can significantly improve the throughput obtained by the critical flows, compared with the shortest path routing algorithm used in current networks.