In one of the largest-ever acquisitions of an e-commerce company, Wal-Mart agreed to buy Jet.com for about $3 billion.