In the past year, Wal-Mart (WMT 0.46%) has shown a growing interest in building a large fleet of small-format stores. The new "Wal-Mart Express" concept in particular has the potential to revolutionize the megaretailer's market position, posing a big threat to dollar stores in the process.

On Monday, Dollar Tree (DLTR -0.16%) announced plans to buy Family Dollar (FDO.DL). The $8.5 billion deal will unite two of the top three U.S. dollar store chains. From a strategic perspective, this merger may be intended to put the combined company in a better position for the looming battle with Wal-Mart.

Wal-Mart wants to go small
Since the Great Recession, dollar stores have grown at Wal-Mart's expense, gaining wallet share through a combination of low prices and convenience. Last fall, Wal-Mart laid out a strategy to strike back by increasing its market presence with smaller-format stores.

Wal-Mart's new strategy. Image source: Wal-Mart's 2013 Investor Day Presentation.

First, this entails building more Wal-Mart Neighborhood Markets. These stores average 38,000 square feet and compete with grocery stores and drugstores, as well as dollar stores. The Neighborhood Market concept is 15 years old, but Wal-Mart decided last year to double down on these stores to capture a higher portion of customers' grocery spending.

More recently, Wal-Mart introduced a new concept: Wal-Mart Express. These stores are about 12,000 square feet on average, close to the typical 8,000-10,000-square-foot footprint of a dollar store. They are designed to compete directly with dollar stores, with a similar selection of groceries, including some fresh foods and a pharmacy counter. Many locations also have a gas station.

Customers can also order items online that are only carried in Wal-Mart Supercenters and pick them up at a more convenient Wal-Mart Express. This will enable customers to use Wal-Mart Express for items that dollar stores would never carry.

Wal-Mart is starting to rapidly add Wal-Mart Express stores. Photo source: Wal-Mart.

At the beginning of 2014, Wal-Mart operated just 20 Wal-Mart Express stores. However, it plans to open 90 to 100 Express locations this year, indicating that executives were very happy with the pilot program. That's no surprise, given that the initial batch of Wal-Mart Express stores posted double-digit comparable-store sales growth in the first half of last year.

In total, Wal-Mart plans to open 270 to 300 small-format stores this year. In the future, the pace of openings could accelerate. Based on Wal-Mart's most recent financial guidance update, it appears the company is spending an average of $4 million to build each small-format store. (Presumably, the larger Neighborhood Markets are more expensive than the Wal-Mart Express stores.)

Wal-Mart's current annual domestic capital budget of roughly $6.5 billion could support hundreds of Walmart Express store openings per year. (The three top dollar store chains have added nearly 10,000 stores in the last decade, highlighting the potential to grow rapidly in this business.) If Wal-Mart Express stores keep outperforming, dollar stores may soon face off against a rapidly growing competitor with deep pockets.

Dollar stores are bulking up
Dollar stores are growing rapidly, too. Dollar General is the largest such chain in the country, with more than 11,000 stores. It plans to open about 700 new stores this year. The Dollar Tree-Family Dollar merger will push the combined company ahead of Dollar General, to roughly 13,000 stores.

Buying Family Dollar will make Dollar Tree the largest dollar store chain. Photo source: The Motley Fool.

Dollar Tree hopes to generate $300 million of annual synergies within three years of the merger. These savings will be critical to ensuring the combined company's long-term competitiveness if Wal-Mart moves more aggressively into small-format stores.

Shoring up Family Dollar
The merger rescues Family Dollar from an increasingly dire situation. While Dollar Tree actually sells all its items for $1 or less, Family Dollar sells goods at a variety of price points. This makes it more vulnerable to competition from Wal-Mart, which is much more efficient due to its massive scale.

Furthermore, Family Dollar has already seen sales stagnate, and it has the lowest profit margin of the three big dollar store chains. Joining forces with Dollar Tree will allow Family Dollar to get better pricing from vendors. It will also reduce the chain's costs, as Dollar Tree and Family Dollar stores can use the same distribution centers and delivery trucks.

Unlike the other big dollar store chains, Dollar Tree sells everything for $1 or less. Photo source: The Motley Fool.

More important, Dollar Tree's purchase of Family Dollar gives the combined company an escape route in case competition from Wal-Mart takes a toll on Family Dollar's sales. Dollar Tree plans to keep operating the Family Dollar chain as a separate concept, but it will consider converting stores between the Dollar Tree and Family Dollar brands based on performance.

Dollar Tree's true dollar store format is more differentiated from Wal-Mart Express. Thus, if Wal-Mart decides to roll out Express more broadly, Dollar Tree could blunt the impact by converting more Family Dollar stores to the Dollar Tree brand.

Foolish final thoughts
Wal-Mart isn't going to upend the dollar stores overnight. The 90 to 100 Express locations opening this year are just a drop in the bucket compared to the nearly 25,000 stores operated by the top three dollar store brands.

However, Wal-Mart has the financial resources to rapidly add Wal-Mart Express locations in the next decade if these smaller stores continue to outperform. Dollar stores need to be ready to fend off this threat.

Dollar Tree's Family Dollar buyout will put the combined company in a better position to fight back. Merger synergies will allow it to cut costs, and it could pass some of those savings on to customers. The merger could also ultimately lead to the conversion of Family Dollar stores to the Dollar Tree brand, if the "pure" dollar store format is more successful.