Ad hoc network is an infra structure less network, which is formed by heterogeneous mobile devices like laptops, PDAs, cell phones etc. which have different computational capability, power, hardware and software. These devices can be integrated to form an infrastructure known as grid. In order to effectively share and use these heterogeous resources we visualize a grid overlay on this network. The major challenge in forming a grid over an ad hoc network is the mobility of the nodes. In this paper, we porpose an architecture for a mobile ad hoc grid and address the challenges due to mobility by considering a trace model for the movement of the nodes. We demonstrate the feasibility of forming a grid over a mobile ad hoc network by proposing lightweight algorithms for grid formation, resource discovery, negotiation, job scheduling, and resource sharing. We propose the use of an M/M/m queuing model to analyze the performance of such a grid and verify the results using simulation studies.