Safeway and PepsiCo are teaming up with Foursquare to reinvent the way grocery store shoppers think about location-based rewards and checkins. As part of the deal, Safeway has integrated Foursquare into its VonsClub loyalty program for a three-month pilot program that kicks off today.

The crux of the program is that VonsClub members can now link their Foursquare () accounts to unlock PepsiCo rewards every time they shop.

Shoppers who link their accounts will earn instant Foursquare rewards on PepsiCo products — in the form of coupons printed at the register — at the time of sale. Rewards are also personalized to the user and tied to the types of badges a Foursquare user has already unlocked.

The program is being tested at roughly 300 Vons grocery stores in southern California, as first reported by Fast Company.

Foursquare and VonsClub members can optionally select to have the system automatically check them in at the time of purchase, via VonsClub card swipe, and send out a shout on Foursquare when they unlock a reward.

The whole program is deeply integrated into Safeway’s point-of-sale system and existing loyalty program. It’s modeled around Tasti D-Lite’s avant garde loyalty program introduced earlier this year, we hear.

For Foursquare, this partnership is not about the kind of deals you can find from competing services such as Facebook Places, but instead is focused around actual customer loyalty.

“One powerful use of Foursquare is helping consumers socialize their loyalty, to offer experiences that go beyond a simple card and are truly tailored to them as individuals,” Tristan Walker, Foursquare’s head of business development tells Mashable (). “If I earn the Gym Rat badge, that says something about me that a couple of stamps on a punch card or scan of a loyalty card cannot; we want to explore ways for consumers and retailers to both benefit from that. With nearly 5 million users, Foursquare is perfectly positioned to move this idea forward.”

Mashable has also learned that Catalina Marketing played a significant role in today’s announcement. The company powers the coupons that get printed out at registers at thousands of retailers across the nation.