Driven by technology, convenience, and shifting strategies, the battle between Walmart and Amazon is reshaping the grocery industry’s competitive landscape.