Electromagnetic interference, equipment noise, multi-path effects and obstructions in harsh smart grid environments make the quality-of-service (QoS) communication a challenging task for WSN-based smart grid applications. To address these challenges, a cognitive communication based cross-layer framework has been proposed. The proposed framework exploits the emerging cognitive radio technology to mitigate the noisy and congested spectrum bands, yielding reliable and high capacity links for wireless communication in smart grids. To meet the QoS requirements of diverse smart grid applications, it differentiates the traffic flows into different priority classes according to their QoS needs and maintains three dimensional service queues attributing delay, bandwidth and reliability of data. The problem is formulated as a Lyapunov drift optimization with the objective of maximizing the weighted service of the traffic flows belonging to different classes. A suboptimal distributed control algorithm (DCA) is presented to efficiently support QoS through channel control, flow control, scheduling and routing decisions. In particular, the contributions of this paper are three folds; employing dynamic spectrum access to mitigate with the channel impairments, defining multi-attribute priority classes and designing a distributed control algorithm for data delivery that maximizes the network utility under QoS constraints. Performance evaluations in ns-2 reveal that the proposed framework achieves required QoS communication in smart grid.