Japan's third-biggest convenience store operator FamilyMart Co. has agreed to buy smaller local rival Cocostore Corp. for around ¥13 billion as part of a major industry realignment in the face of a shrinking domestic market, the company announced Tuesday.