Single-functional battery units (BUs) are commonly utilized in most studies related to microgrids (MGs). This paper proposes efficient energy management of MG's resources including wind power turbines (WPTs), photovoltaic systems (PVs), BUs, and diesel generator units (DGUs). The proposed study aims to utilize the multifunctional capabilities of BUs to minimize the hourly costs of MG and thereby reduce the overall daily operating costs of MG. To achieve this, various potential scenarios are considered within the system policy to efficiently utilize the BUs for performing multiple functions including matching power generation from the renewable energy sources (RESs) with the demand (G/D) and performing energy arbitrage (EA). This work considers several factors, including two modes of MG operation (grid-connected mode and islanded mode), as well as demand-side management (DSM). Furthermore, the study addresses uncertainties associated with various parameters, affecting wind power and solar power, using the Latin Hypercube Sampling (LHS) approach. The metaheuristic technique known as Moth-Flame Optimization (MFO) is utilized to solve the formulated constrained nonlinear optimization problem. To verify the obtained optimal solutions, the Hybrid Firefly and Particle Swarm Optimization (HFPSO) technique is also utilized. Several case studies, considering various operating conditions, are done to investigate the proposed study. Finally, a comparison is made between four case studies to clarify the importance of the multi-functional BUs in achieving the objective of the proposed study. The results show that the multi-functional BUs case study achieves the lowest daily cost ($7701) compared to the singlefunctional BUs case studies ($8981.5 for EA and $9052 for G/D). The implementation and solutions of the proposed problem are done using MATLAB software.