They are pine cones with an aromatic scent. They are most likely an air freshener since they are scented.
Role in episode
When SpongeBob and Patrick are looking for Gary after he runs away, Patrick is distracted by the supermarket having a sale on scented pine cones, so he rushes into the store but can't find them. He then asks Granny if she knows where they are, to which she nicely responds by saying she hopes he wasn't looking to buy them because she already picked up a batch of all the cones left, leaving Patrick saddened and bidding farewell to the scented pine cones prior to leaving the store.