A model of the second-harmonic-generating (chi((2))) optical medium with a Bragg grating is considered. Two components of the fundamental harmonic (FH) are assumed to be resonantly coupled through the Bragg reflection, while the second harmonic (SH) propagates pal allel to the grating, hence its dispersion (diffraction) must be explicitly taken into consideration. It is demonstrated that the system can easily generate stable three-wave gap solitons of two different types (free-tail and tail-locked ones) that are identified analytically according to the structure of their tails. The stationary fundamental solitons are sought for analytically, by means of the variational approximation, and numerically. The results produced by the two approaches are in fairly reasonable agreement. The existence boundaries of the soliton are found in an exact form. The stability of the solitons is determined by direct partial differential equation simulations. A threshold value of an effective FH-SH mismatch parameter is found, the soliton being stable above the threshold and unstable below it. The stability threshold strongly depends on the soliton's wave-number shift k and very weakly on the SH diffraction coefficient. Stationary two-soliton bound states are found, too, and it is demonstrated numerically that they are stable if the: mismatch exceeds another threshold, which is close to that for the fundamental soliton. At k<0, the stability thresholds do not exist, as all the fundamental and two-solitons are stable. With the increase of the mismatch, the two-solitons disappear, developing a singularity at another, very high, threshold. The existence of the stable two-solitons is a drastic difference of the present model from the earlier investigated chi((2)) systems. It is argued that both the fundamental solitons and two-solitons can be experimentally observed in currently available optical materials with the quadratic nonlinearity. [S1063-651X(98)09811-0].